﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:personalplaner.common.controls"
                    xmlns:pc="clr-namespace:personalplaner.business.dienstplan.plancollection;assembly=personalplaner.business"
                    xmlns:p="clr-namespace:personalplaner.business.dienstplan;assembly=personalplaner.business"
                    xmlns:conv="clr-namespace:personalplaner.common.converters"
                    xmlns:pt="clr-namespace:personalplaner.common.controls.primitives">


    <conv:ColorToSolidColorBrushConverter x:Key="colorToBrush"/>
    <BooleanToVisibilityConverter x:Key="boolToVis"/>
    <pt:DiensteCellTemplateSelector x:Key="dienstTemplateSelector"/>

    <Style x:Key="DataGridColumnHeaderStyle1"  TargetType="{x:Type DataGridColumnHeader}"  >
        <Setter Property="Background" Value="#40FFFFFF" />
        <Setter Property="Foreground" Value="#E1000000" />
        <Setter Property="FontWeight" Value="Heavy"/>
        <Setter Property="BorderBrush" Value="#E1000000"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}" >
                    <!--<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,1" >-->
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0,0.5,1" Margin="-1,0,-1,0">
                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3,0,3,0"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="DataGridColumnHeaderStyle2" TargetType="{x:Type DataGridColumnHeader}"  >
        <Setter Property="Background" Value="#40FFFFFF" />
        <Setter Property="Foreground" Value="#E1000000" />
        <Setter Property="FontWeight" Value="Heavy"/>
        <Setter Property="BorderBrush" Value="#E1000000"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}" >
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0,0.5,1" Margin="-1,0,-1,0">
                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2,0,2,0"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />    
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" SnapsToDevicePixels="True">
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="DataGridCell.IsSelected" Value="True">
                            <Setter Property="Background" Value="#18000000" />
                            <Setter Property="Foreground" Value="#80000000" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="TransparentButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Background="Transparent" BorderBrush="Transparent" >
                        <ContentPresenter ContentSource="Content"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GridStyle" TargetType="{x:Type DataGrid}">
        <Setter Property="AutoGenerateColumns" Value="False"/>
        <Setter Property="CanUserAddRows" Value="False"/>
        <Setter Property="SelectionMode" Value="Single"/>
        <Setter Property="SelectionUnit" Value="Cell"/>
        <Setter Property="HeadersVisibility" Value="Column"/>
        <Setter Property="CellStyle" Value="{StaticResource DataGridCellStyle}"/>
        <Setter Property="HorizontalGridLinesBrush" Value="LightGray"/>
        <Setter Property="VerticalGridLinesBrush" Value="LightGray"/>
        <Setter Property="Background" Value="#25FFFFFF"/>
        <Setter Property="Foreground" Value="#E1000000"/>
        <Setter Property="BorderBrush" Value="#E1000000"/>
        <!--<Setter Property="RowHeight" Value="19"/>-->
        <Setter Property="RowHeight" Value="{Binding RowHeight, RelativeSource={RelativeSource AncestorType={x:Type local:PlanGrid}}}"/>
        <Setter Property="ColumnHeaderHeight" Value="20"/>
    </Style>

    <Style x:Key="TeamHeaderStyle" TargetType="{x:Type GroupItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupItem}">
                    <Expander x:Name="exp" IsExpanded="True" Background="Orange">
                        <Expander.Header>
                            <TextBlock Text="{Binding Team}"/>
                        </Expander.Header>
                        <ItemsPresenter/>
                    </Expander>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- 
    *****************************************************************
    Template for the PlanGrid
    *****************************************************************
    -->
    <Style TargetType="{x:Type local:PlanGrid}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type  local:PlanGrid}" >

                    <ControlTemplate.Resources>
                        <DataTemplate x:Key="PART_CellTemplate">
                            <Grid>
                                <Border Background="{Binding BackgroundColor, Converter={StaticResource colorToBrush}}" Focusable="False"/>
                                <Border Background="{Binding Color, Converter={StaticResource colorToBrush}}">
                                    <Button Style="{StaticResource TransparentButtonStyle}" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:PlanGrid}, AncestorLevel=1}, Path=Command}" CommandParameter="{Binding}" >
                                        <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,1,2,1" FontWeight="DemiBold" FontSize="10"/>
                                    </Button>
                                </Border>
                            </Grid>
                        </DataTemplate>

                        <DataTemplate x:Key="PART_DienstOverviewCellTemplate">
                            <Grid>
                                <Border Background="{Binding Color, Converter={StaticResource colorToBrush}}">
                                    <TextBlock Text="{Binding Difference}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,1,2,1" FontWeight="DemiBold" FontSize="10"/>
                                </Border>
                            </Grid>
                        </DataTemplate>
                        
                    </ControlTemplate.Resources>
                    
                    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <!--<ListView x:Name="PART_PersonenGrid" ItemsSource="{TemplateBinding Collection}" IsHitTestVisible="False" Padding="-3,-1,-6,0" 
                                      FontWeight="DemiBold" FontSize="11" Foreground="#E1000000" BorderBrush="#E1000000" MaxWidth="180" Width="Auto">
                                <ListView.Resources>
                                    <Style TargetType="GridViewColumnHeader">
                                        <Setter Property="Background" Value="#40FFFFFF" />
                                        <Setter Property="Foreground" Value="#E1000000" />
                                        <Setter Property="FontWeight" Value="Heavy"/>
                                        <Setter Property="BorderBrush" Value="#E1000000"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}" >
                                                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0,0.5,1" Margin="-1,0,-1,0">
                                                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,2,4,2"/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ListView.Resources>

                                <ListView.ItemContainerStyle>
                                    <Style TargetType="ListViewItem">
                                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                                        <Setter Property="VerticalContentAlignment" Value="Stretch" />
                                        <Setter Property="Margin" Value="0"/>
                                        <Setter Property="Padding" Value="0"/>
                                    </Style>
                                </ListView.ItemContainerStyle>

                                <ListView.View>
                                    <GridView >
                                        <GridViewColumn Header="Name" >
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" HorizontalAlignment="Stretch" Margin="-6,-2,-5,-2" >
                                                        <TextBlock Text="{Binding Name}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,2.3,2,2" />
                                                    </Border>
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                        <GridViewColumn Header="Pensum" Width="Auto">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" HorizontalAlignment="Stretch" Margin="-6,-2,-5,-2" >
                                                        <TextBlock Text="{Binding Pensum}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,2.3,2,2" >
                                                            <TextBlock.Style>
                                                                <Style TargetType="TextBlock">
                                                                    <Style.Triggers>
                                                                        <DataTrigger Binding="{Binding Pensum}" Value="0">
                                                                            <Setter Property="Visibility" Value="Hidden"/>
                                                                        </DataTrigger>
                                                                    </Style.Triggers>
                                                                </Style>
                                                            </TextBlock.Style>
                                                        </TextBlock>
                                                    </Border>
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                    </GridView>
                                </ListView.View>
                            </ListView>-->
                            
                            <DataGrid x:Name="PART_PersonenGrid"
                                      ItemsSource="{TemplateBinding Collection}" 
                                      Style="{StaticResource GridStyle}"
                                      ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle1}"
                                      VerticalScrollBarVisibility="Disabled"
                                      FontWeight="DemiBold"
                                      IsReadOnly="{TemplateBinding IsReadOnly}"
                                      local:DataGridExtensions.ReferencedGrid="{Binding ElementName=DienstOverviewHeaderGrid}" 
                                      MaxWidth="180" Width="Auto" HorizontalAlignment="Left" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                                <DataGrid.GroupStyle>
                                    <GroupStyle ContainerStyle="{StaticResource TeamHeaderStyle}">
                                        <GroupStyle.Panel>
                                            <ItemsPanelTemplate>
                                                <DataGridRowsPresenter/>
                                            </ItemsPanelTemplate>
                                        </GroupStyle.Panel>
                                    </GroupStyle>
                                </DataGrid.GroupStyle>
                                <DataGrid.Columns>
                                    <local:DataGridPlanItemTemplateColumn Header="Name"  ><!--Width="1*"-->
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Name, NotifyOnTargetUpdated=True}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                    
                                    <local:DataGridPlanItemTemplateColumn Header="Pensum" Width="Auto"> <!--Width="SizeToHeader"-->
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Pensum, NotifyOnTargetUpdated=True}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,1,2,1">
                                                        <TextBlock.Style>
                                                            <Style TargetType="TextBlock">
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding Pensum}" Value="0">
                                                                        <Setter Property="Visibility" Value="Hidden"/>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </TextBlock.Style>
                                                    </TextBlock>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>

                            <local:DiensteDataGrid x:Name="PART_DiensteGrid"  Grid.Column="1"  Margin="5,0,0,0" 
                                      Style="{StaticResource GridStyle}" 
                                      ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle2}"
                                      local:DataGridExtensions.ReferencedGrid="{Binding ElementName=PART_DiensteOverviewGrid}"
                                                   IsReadOnly="{TemplateBinding IsReadOnly}"
                                                  AutoGenerateColumns="False"
                                                   CellTemplateSelector="{StaticResource dienstTemplateSelector}"> <!-- ItemsSource="{TemplateBinding Items}"-->
                                <!--<DataGrid.GroupStyle>
                                    <GroupStyle ContainerStyle="{StaticResource TeamHeaderStyle}">
                                        <GroupStyle.Panel>
                                            <ItemsPanelTemplate>
                                                <DataGridRowsPresenter />
                                            </ItemsPanelTemplate>
                                        </GroupStyle.Panel>
                                    </GroupStyle>
                                </DataGrid.GroupStyle>-->
                            </local:DiensteDataGrid>


                            <DataGrid x:Name="PART_SaldoGrid" Grid.Column="2" Margin="5,0,0,0" 
                                      ItemsSource="{TemplateBinding Collection}" 
                                      Style="{StaticResource GridStyle}"
                                      ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle2}"
                                      VerticalScrollBarVisibility="Disabled"
                                      IsReadOnly="{TemplateBinding IsReadOnly}"
                                      FontWeight="DemiBold" HorizontalScrollBarVisibility="Disabled" >

                                <DataGrid.GroupStyle>
                                    <GroupStyle ContainerStyle="{StaticResource TeamHeaderStyle}">
                                        <GroupStyle.Panel>
                                            <ItemsPanelTemplate>
                                                <DataGridRowsPresenter/>
                                            </ItemsPanelTemplate>
                                        </GroupStyle.Panel>
                                    </GroupStyle>
                                </DataGrid.GroupStyle>
                                <DataGrid.Columns>
                                    <local:DataGridPlanItemTemplateColumn Header="Vortr">
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding RowColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Vortrag}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                    <local:DataGridPlanItemTemplateColumn Header="Soll">
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding RowColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Soll}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                    <local:DataGridPlanItemTemplateColumn Header="Haben" >
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding RowColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Haben}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                    <local:DataGridPlanItemTemplateColumn Header="Anp.">
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding RowColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Anpassung}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                    <local:DataGridPlanItemTemplateColumn Header="Diff">
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding RowColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Differenz}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>

                                </DataGrid.Columns>
                            </DataGrid>
                            
                            <ListView Grid.Row="1" Margin="0,5,0,0" x:Name="PART_DienstOverviewHeaderGrid" ItemsSource="{TemplateBinding PlanDienstOverview}" IsHitTestVisible="False" Padding="-3,-1,-6,0" FontWeight="DemiBold" FontSize="11" Foreground="#E1000000" BorderBrush="#E1000000">
                               <ListView.Resources>
                                    <Style TargetType="GridViewColumnHeader">
                                        <Setter Property="Background" Value="#40FFFFFF" />
                                        <Setter Property="Foreground" Value="#E1000000" />
                                        <Setter Property="FontWeight" Value="Heavy"/>
                                        <Setter Property="BorderBrush" Value="#E1000000"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}" >
                                                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0,0.5,1" Margin="-1,0,-1,0">
                                                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,2,4,2"/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ListView.Resources>
                                
                                <ListView.ItemContainerStyle>
                                    <Style TargetType="ListViewItem">
                                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                                        <Setter Property="VerticalContentAlignment" Value="Stretch" />
                                        <Setter Property="Margin" Value="0"/>
                                        <Setter Property="Padding" Value="0"/>
                                    </Style>
                                </ListView.ItemContainerStyle>
                                
                                <ListView.View>
                                    <GridView >
                                        <GridViewColumn Header="Team" >
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" HorizontalAlignment="Stretch" Margin="-6,-2,-5,-2" >
                                                        <TextBlock Text="{Binding Abteilung}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,2.3,2,2" />
                                                    </Border>
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                        <GridViewColumn Header="Dienst" Width="Auto">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                    <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" HorizontalAlignment="Stretch" Margin="-6,-2,-5,-2" >
                                                        <TextBlock Text="{Binding Name}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,2.3,2,2" />
                                                    </Border>
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                    </GridView>
                                </ListView.View>
                            </ListView>
                            
                            <!--<DataGrid x:Name="PART_DienstOverviewHeaderGrid"
                                Grid.Row="1"
                                      Margin="0,5,0,0"
                                      ItemsSource="{TemplateBinding PlanDienstOverview}" 
                                      Style="{StaticResource GridStyle}"
                                      ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle1}"
                                      VerticalScrollBarVisibility="Disabled"
                                      IsReadOnly="{TemplateBinding IsReadOnly}"
                                      FontWeight="DemiBold" MaxWidth="180"  >
                                <DataGrid.GroupStyle>
                                    <GroupStyle ContainerStyle="{StaticResource TeamHeaderStyle}">
                                        <GroupStyle.Panel>
                                            <ItemsPanelTemplate>
                                                <DataGridRowsPresenter/>
                                            </ItemsPanelTemplate>
                                        </GroupStyle.Panel>
                                    </GroupStyle>
                                </DataGrid.GroupStyle>
                                <DataGrid.Columns>
                                    <local:DataGridPlanItemTemplateColumn Header="Team" >
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" HorizontalAlignment="Stretch" >
                                                    <TextBlock Text="{Binding Abteilung}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                    <local:DataGridPlanItemTemplateColumn Header="Dienst" Width="50">
                                        <local:DataGridPlanItemTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Background="{Binding HeaderColor, Converter={StaticResource colorToBrush}}" >
                                                    <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,1,2,1"/>
                                                </Border>
                                            </DataTemplate>
                                        </local:DataGridPlanItemTemplateColumn.CellTemplate>
                                    </local:DataGridPlanItemTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>-->

                            <DataGrid x:Name="PART_DiensteOverviewGrid" Grid.Row="1" Grid.Column="1"  Margin="5,5,0,0" 
                                      Style="{StaticResource GridStyle}"
                                      IsReadOnly="{TemplateBinding IsReadOnly}"
                                      ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle2}">
                                <DataGrid.GroupStyle>
                                    <GroupStyle ContainerStyle="{StaticResource TeamHeaderStyle}">
                                        <GroupStyle.Panel>
                                            <ItemsPanelTemplate>
                                                <DataGridRowsPresenter />
                                            </ItemsPanelTemplate>
                                        </GroupStyle.Panel>
                                    </GroupStyle>
                                </DataGrid.GroupStyle>
                            </DataGrid>
                            
                        </Grid>
                    </ScrollViewer>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="PlanDienstOverview" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_DienstOverviewHeaderGrid"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_DiensteOverviewGrid"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="ShowSollColumn" Value="False"/>
                                <Condition Property="ShowHabenColumn" Value="False"/>
                                <Condition Property="ShowDiffColumn" Value="False"/>
                                <Condition Property="ShowAnpassungColumn" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_SaldoGrid" Property="Visibility" Value="Collapsed"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>